<template>
	<g-page :is-tabbar="true">
		<view class="center">
			<!-- <view class="center_top"  :style="{backgroundImage:`url(${imageUrl}/banner.jpg)`}"> -->
			<view class="center_top" style="background-color: #cb2921;">
				<view class="mask"></view>
			</view>
			<view class="center_box_bg">
				<view class="profily">
					<view class="base">
						<view class="profily_header">
							<open-data type="userAvatarUrl" ></open-data>
						</view>
						<open-data type="userNickName" style="margin-left: 35rpx;font-size: 1.3em;"></open-data>
						<u-icon size="40" style="position: absolute;right: 20rpx;top: 10rpx;" 
						name="setting" color="red" @click="toPage('user_info')"/>
					</view>
					<view v-if="token == '1' || token == '' " class="renzhen" @click="toPage('register')" >
						<view >去认证</view>
					</view>
					<view class="renzhen" v-else-if="token=='2'" @click="toPage1('hservice')">
						<view >去认证</view>
					</view>		
					<view v-else class="renzhen">已认证</view>
					
				</view>
				<view class="baiban">
				</view>
				<view class="center_menu">
					<view class="menu_item" v-for="item in menus" @click="toPage(item.key)" :key="item.key">
						<!-- <image :src="item.icon" mode="aspectFill"></image> -->
						<u-icon size="40" :name="item.icon" v-if="item.key=='mailList'||item.key=='about'"  color="red" />
						<u-icon size="40" :name="item.icon" v-else custom-prefix="custom-icon" color="red" />
						<text>{{item.name}}</text>
					</view>
				</view>
			</view>
		</view>
	</g-page>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from 'vuex'
	
	export default {
		
		data() {
			return {
				//用户信息
				userInfo:{},
				token:"",
				imageUrl:this.$t.URL.staticImg,
				//菜单
				menus: [{
						name: '电子校友卡',
						icon: 'id-card-fill',
						key: 'alumniCard',
					},
					{
						name: '创建校友群组',
						icon: 'group-fill',
						key: 'createAlumni',
					},
					{
						name: '校友通讯录',
						icon: 'phone-fill',
						key: 'mailList',
					},					
					{
						name: '校友申请列表',
						icon: 'group-fill',
						key: 'authen',
					},
					{
						name: '已加入的校友会',
						icon: 'branch-fill',
						key: 'joinedAlumniGroup',
					},
					{
						name: '校庆活动',
						icon: 'flag-fill',
						key: 'activityRegistration',
					},
					{
						name: '关于我们',
						icon: 'info-circle-fill',
						key: 'about',
					}
				],
				/*  */
			};
		},
		computed: {
			...mapState(['USER'])
		},
		onLoad: function(options) {
			//设置选则最大时间(当前年)
			this.userInfo = this.USER.userInfo;
			this.token = this.USER.token;
			console.log("token:", this.token);
		},
		methods: {
			/* 获取用户信息 */
			
			/* 跳转对应页面 */
			toPage(key){
				if(key == 'about'){
					uni.navigateTo({
						url:'./pages/'+key
					})
				}else if(key == 'register'){
					this.$Router.push({name:'authorization'});
				}else if(this.USER.token == 1 || this.USER.token == 2 || this.USER.token == ''){
						uni.showToast({
							title: "请先去认证！",
							icon: 'none',
							duration: 2000
						});
						return;
				}else if(key == 'user_info'){
					this.$Router.push({name:'user_info'});
				}else{
					uni.navigateTo({
						url:'./pages/'+key
					})
				
			}
		},
		//跳转到人工审核
		toPage1(key){
			uni.navigateTo({
				url:'./pages/'+key
			})
		}
	},
}
</script>

<style lang="scss">
	page {
		height: 100%;
	}

	.profily,
	.profily_header {
		background-color: #FFFFFF;
		border-radius: 8px;
		z-index: 999;
	}
	.renzhen{
		position: absolute;
		left: 190rpx;
		top: 127rpx;
		font-size: 1.05em;
		color: #96969a;
	}

	.center {
		height: 100%;

		&_top {
			height: 18%;
			background:  no-repeat 0% 50%;
			background-size: cover;
			// background: #E6E6E6;
			.mask {
				//background: rgba(225, 225, 225, 0.4);
				height: 100%;
			}
		}

		&_box_bg {
			background: #F9F9F9;
			position: relative;

			.profily {
				position: absolute;
				width: 90%;
				// border:1px solid #F7F7F7;
				margin: 0 auto;
				top: -100upx;
				left: 5%;
				background: #FEFEFE;
				padding: 35upx;
				box-sizing: border-box;
				box-shadow: 0px 2px 5px #EDEDED;
			}
		}
	}

	.base {
		display: flex;
		align-items: center;
		padding-bottom: 35upx;
		position: relative;

		.profily_header {
			height: 120upx;
			width: 120upx;
			background-size: 100%;
		}

		text {
			margin-left: 20px;
			font-size: 30upx;
		}

		image {
			position: absolute;
			height: 40upx;
			width: 40upx;
			right: 0px;
			top: 0px;
		}
	}

	.order_status {
		display: flex;
		justify-content: space-between;
		margin-top: 35upx;

		.status {
			width: 140upx;
			font-size: 24upx;
			text-align: center;
			letter-spacing: .5px;
			display: flex;
			flex-direction: column;

			.icon {
				width: 50upx;
				height: 50upx;
				margin: 0 auto;
				margin-bottom: 5px;

			}
		}
	}

	.baiban {
		background: #FEFEFE;
		height: 150upx;
	}

	.center_menu {
		width: 100%;
		display: inline-block;

		.menu_item {
			font-size: 28upx;
			letter-spacing: 1px;
			padding: 10px 5%;
			background: #FEFEFE;
			overflow: hidden;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			position: relative;
			border-bottom: 1px solid #EFEFEF;

			&:hover {
				background: #F6F6F6 !important;
			}

			&::after {
				content: '';
				width: 30upx;
				height: 26upx;
				position: absolute;
				right: 5%;
				// background: url('../../static/fumou-center-template/right.png') no-repeat;
				background-size: 100%;
			}

			text:nth-of-type(1) {
				margin-left: 10px;
			}

			image {
				width: 40upx;
				height: 40upx;
			}

			&:nth-of-type(4) {
				margin-top: 10px;
			}
		}
	}
</style>
